public class Test {
    //递归求 1 + 2 + 3 + ... + 10
    public static int sum(int m){
        if (m == 1){
            return 1;
        }
        int ret=m+sum(m-1);
        return ret;
    }

    public static void main(String[] args) {
        System.out.println(   sum(10));
    }




    //按顺序打印⼀个数字的每⼀位(例如 1234 打印出 1 2 3 4)
    public static  void print(int n){
        if(n<=9){
            System.out.println(n);
        }else{
            print(n/10);
            System.out.println(n%10);
        }
    }

    public static void main2(String[] args) {
        print(1234);
    }

    //递归求 N 的阶乘
    public static int fac(int n ){
        if(n == 1){
            return 1;
        }
        int tmp = n*fac(n-1);
        return tmp;
    }
    public static void main1(String[] args) {
        System.out.println(fac(5));
    }
}
